#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time      :2021/7/15 16:16
# @Author    :cjw
"""哈希密码处理"""
from passlib.context import CryptContext

# 密码哈希加密方式
pwd_context = CryptContext(schemes=['bcrypt'], deprecated='auto')


def verify_password(plain_password: str, hashed_password: str) -> bool:
	"""
	密码哈希校验
	:param plain_password: 明文密码
	:param hashed_password: 哈希密码
	:return:
	"""
	return pwd_context.verify(plain_password, hashed_password)


def get_password_hash(password: str):
	"""
	明文密码哈希加密
	:param password: 明文密码
	:return:
	"""
	return pwd_context.hash(password)